package com.xyx.ssm.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xyx.ssm.dao.SyauthorityMapper;
import com.xyx.ssm.jdbcdao.SyauthorityDao;
import com.xyx.ssm.po.Syauthority;
import com.xyx.ssm.service.SyauthorityService;

@Service("syauthorityService")
public class SyauthorityServiceImpl implements SyauthorityService {
	@Autowired
	private SyauthorityDao syauthorityDao;
	
	@Autowired
	private SyauthorityMapper syauthorityMapper;
	/**
	 * 查询所有权限
	 */
	@Override
	public List<Map<String, Object>> selectSyauthorityadd() {
		// TODO Auto-generated method stub
		return syauthorityDao.selectSyauthorityadd();
	}
     /**
      * 增加权限
      */
	@Override
	public int insert(Syauthority record) {
		// TODO Auto-generated method stub
		return syauthorityMapper.insert(record);
	}
	@Override
	public int SyauthorityDelete(String id) {
		// TODO Auto-generated method stub
		int n = 0;
		String[] s = id.split(",");
		for (int i = 0; i < s.length; i++) {
			Integer id1 = Integer.parseInt(s[i]);
			n = syauthorityDao.SyauthorityDelete(id1);
		}
		return n;
	}
	@Override
	public int SyauthorityUpdate(Syauthority syauthority) {
		// TODO Auto-generated method stub
		return syauthorityDao.SyauthorityUpdate(syauthority);
	}
	@Override
	public List<Syauthority> selallauthority() {
		// TODO Auto-generated method stub
		System.out.println(syauthorityMapper.selallauthority());
		return syauthorityMapper.selallauthority();
	}
	@Override
	public int deleteall(int roleid) {
		// TODO Auto-generated method stub
		return syauthorityMapper.deleteall(roleid);
	}
	
}
